package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Comment;
import cn.tedu._04mybatis.pojo.vo.CommentVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommentMapper {
    @Insert("insert into comment(content,created,user_id,weibo_id)  values(#{content},#{created},#{userId},#{weiboId})")
    int insertComment(Comment comment);

    @Delete("delete from comment where id=#{cid}")
    int deleteById(Long cid);

    @Update("update comment set content=#{content} where id=#{id}")
    int updateById(Comment comment);

    @Select("select id, content,user_id userId,weibo_id weiboId,created from comment where id=#{cid}")
    List<Comment> selectCommentById1(Long cid);

    @Select("select content,user_id userId from comment where id=#{cid}")
    List<CommentVo> selectCommentById2(Long cid);
}
